<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回最后一次调用 json_encode() 或 json_decode() 时产生的错误信息</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.json-encode.html">« json_encode</a></li>
      <li style="float: right;"><a href="function.json-last-error.html">json_last_error »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.json.html">JSON 函数</a></li>
    <li>返回最后一次调用 json_encode() 或 json_decode() 时产生的错误信息</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.json-last-error-msg" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">json_last_error_msg</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">json_last_error_msg</span> &mdash; <span class="dc-title">返回最后一次调用 json_encode() 或 json_decode() 时产生的错误信息</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.json-last-error-msg-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>json_last_error_msg</strong></span>(): <span class="type">string</span></div>

  <p class="para rdfs-comment">
   当没有设置 <strong><code>JSON_THROW_ON_ERROR</code></strong> 参数时，返回最后一次调用 <span class="function"><a href="function.json-encode.html" class="function">json_encode()</a></span> 或 <span class="function"><a href="function.json-decode.html" class="function">json_decode()</a></span>
   产生的错误信息。
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.json-last-error-msg-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.json-last-error-msg-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功则返回错误信息，如果没有错误产生则返回 <code class="literal">&quot;No error&quot;</code> 。
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.json-last-error-msg-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.json-last-error.html" class="function" rel="rdfs-seeAlso">json_last_error()</a> - 返回最后发生的错误</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>